﻿using System;
using System.Net;
using System.Web.Mvc;

namespace BrettM.Web.Restful
{
    /// <summary>
    /// 
    /// </summary>
    public class ErrorController : Controller
    {
        /// <summary>
        /// The NotFound method is called as a default route when the requested
        /// route cannot be found.  This will allow a standard page to be displayed
        /// </summary>
        /// <returns></returns>
        public ActionResult NotFound()
        {
            this.Response.StatusCode = (int)HttpStatusCode.NotFound;
            return View("ShowError", null);
        }

        /// <summary>
        /// The InternalServerError will render an html error page describing
        /// the error.
        /// </summary>
        /// <param name="exception"></param>
        /// <returns></returns>
        public ActionResult InternalServerError(Exception exception)
        {
            this.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
            return View("ShowError", exception);
        }

    }
}
